Skip to content

Cache branch names for faster target branch picker in Create PR view#8597

Draft
Copilot wants to merge 6 commits intomainfrom
copilot/support-caching-for-branch-names
Draft

Cache branch names for faster target branch picker in Create PR view#8597
Copilot wants to merge 6 commits intomainfrom
copilot/support-caching-for-branch-names

Conversation

Copy link
Contributor

Copilot AI commented Mar 17, 2026

The target branch picker makes a full GraphQL paginated fetch on every open, causing noticeable delay. Branches should appear instantly on subsequent opens, and pre-fetching should warm the cache before the user even clicks.

Changes

  • In-memory branch cache in GitHubRepository: listBranches() caches results for unprefixed (full list) queries. getCachedBranches() provides synchronous retrieval.
  • Two-phase quickpick population: changeRemoteAndBranch() now shows cached branch picks immediately, then refreshes in the background with fresh API data.
  • Pre-fetch on view init: getCreateParams() fires a non-blocking listBranches() call for the base remote so the cache is warm by the time the user opens the picker.
  • Extracted buildBranchPickItems helper in quickPicks.ts shared by both branchPicks() (async, fetches) and cachedBranchPicks() (sync, cache-only).

Flow

Create PR view opens
  └─ getCreateParams() → prefetchBranches() fires in background
                            └─ listBranches() populates _branchesCache

User clicks base branch picker
  └─ cachedBranchPicks() → instant display from cache
  └─ updateItems() → background refresh with fresh API data

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • update.code.visualstudio.com
    • Triggering command: /opt/hostedtoolcache/node/20.20.1/x64/bin/node node ./out/src/test/runTests.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI and others added 3 commits March 17, 2026 14:15
Co-authored-by: ulugbekna <16353531+ulugbekna@users.noreply.github.com>
Co-authored-by: ulugbekna <16353531+ulugbekna@users.noreply.github.com>
Co-authored-by: ulugbekna <16353531+ulugbekna@users.noreply.github.com>
Copilot AI changed the title [WIP] Add caching support for branch names in new PR view Cache branch names for faster target branch picker in Create PR view Mar 17, 2026
Copilot AI requested a review from ulugbekna March 17, 2026 14:25
@ulugbekna ulugbekna requested a review from alexr00 March 18, 2026 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support caching for branch names in new PR view

3 participants